{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a980ada6",
   "metadata": {},
   "source": [
    "# 数据准备"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "7f421779",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "d42aabc7",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>School</th>\n",
       "      <th>Grade</th>\n",
       "      <th>Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "      <th>Transfer</th>\n",
       "      <th>Test_Number</th>\n",
       "      <th>Test_Date</th>\n",
       "      <th>Time_Record</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Gaopeng Yang</td>\n",
       "      <td>Female</td>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/10/5</td>\n",
       "      <td>0:04:34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Peking University</td>\n",
       "      <td>Freshman</td>\n",
       "      <td>Changqiang You</td>\n",
       "      <td>Male</td>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/9/4</td>\n",
       "      <td>0:04:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Mei Sun</td>\n",
       "      <td>Male</td>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/9/12</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/3</td>\n",
       "      <td>0:04:08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Gaojuan You</td>\n",
       "      <td>Male</td>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>Fudan University</td>\n",
       "      <td>Junior</td>\n",
       "      <td>Xiaojuan Sun</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2019/10/17</td>\n",
       "      <td>0:04:31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Li Zhao</td>\n",
       "      <td>Female</td>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "      <td>N</td>\n",
       "      <td>3</td>\n",
       "      <td>2019/9/22</td>\n",
       "      <td>0:04:03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengqiang Chu</td>\n",
       "      <td>Female</td>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2020/1/5</td>\n",
       "      <td>0:04:48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Shanghai Jiao Tong University</td>\n",
       "      <td>Senior</td>\n",
       "      <td>Chengmei Shen</td>\n",
       "      <td>Male</td>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "      <td>N</td>\n",
       "      <td>2</td>\n",
       "      <td>2020/1/7</td>\n",
       "      <td>0:04:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>Tsinghua University</td>\n",
       "      <td>Sophomore</td>\n",
       "      <td>Chunpeng Lv</td>\n",
       "      <td>Male</td>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "      <td>N</td>\n",
       "      <td>1</td>\n",
       "      <td>2019/11/6</td>\n",
       "      <td>0:05:05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                            School      Grade            Name  Gender  Height  \\\n",
       "0    Shanghai Jiao Tong University   Freshman    Gaopeng Yang  Female   158.9   \n",
       "1                Peking University   Freshman  Changqiang You    Male   166.5   \n",
       "2    Shanghai Jiao Tong University     Senior         Mei Sun    Male   188.9   \n",
       "3                 Fudan University  Sophomore    Xiaojuan Sun  Female     NaN   \n",
       "4                 Fudan University  Sophomore     Gaojuan You    Male   174.0   \n",
       "..                             ...        ...             ...     ...     ...   \n",
       "195               Fudan University     Junior    Xiaojuan Sun  Female   153.9   \n",
       "196            Tsinghua University     Senior         Li Zhao  Female   160.9   \n",
       "197  Shanghai Jiao Tong University     Senior  Chengqiang Chu  Female   153.9   \n",
       "198  Shanghai Jiao Tong University     Senior   Chengmei Shen    Male   175.3   \n",
       "199            Tsinghua University  Sophomore     Chunpeng Lv    Male   155.7   \n",
       "\n",
       "     Weight Transfer  Test_Number   Test_Date Time_Record  \n",
       "0      46.0        N            1   2019/10/5     0:04:34  \n",
       "1      70.0        N            1    2019/9/4     0:04:20  \n",
       "2      89.0        N            2   2019/9/12     0:05:22  \n",
       "3      41.0        N            2    2020/1/3     0:04:08  \n",
       "4      74.0        N            2   2019/11/6     0:05:22  \n",
       "..      ...      ...          ...         ...         ...  \n",
       "195    46.0        N            2  2019/10/17     0:04:31  \n",
       "196    50.0        N            3   2019/9/22     0:04:03  \n",
       "197    45.0        N            1    2020/1/5     0:04:48  \n",
       "198    71.0        N            2    2020/1/7     0:04:58  \n",
       "199    51.0        N            1   2019/11/6     0:05:05  \n",
       "\n",
       "[200 rows x 10 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df=pd.read_csv('D:/data_analysis-master/week02/data/learn_pandas.csv')\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "5e69e2b3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 200 entries, 0 to 199\n",
      "Data columns (total 10 columns):\n",
      " #   Column       Non-Null Count  Dtype  \n",
      "---  ------       --------------  -----  \n",
      " 0   School       200 non-null    object \n",
      " 1   Grade        200 non-null    object \n",
      " 2   Name         200 non-null    object \n",
      " 3   Gender       200 non-null    object \n",
      " 4   Height       183 non-null    float64\n",
      " 5   Weight       189 non-null    float64\n",
      " 6   Transfer     188 non-null    object \n",
      " 7   Test_Number  200 non-null    int64  \n",
      " 8   Test_Date    200 non-null    object \n",
      " 9   Time_Record  200 non-null    object \n",
      "dtypes: float64(2), int64(1), object(7)\n",
      "memory usage: 15.8+ KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "52f32e9a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<bound method Series.unique of 0      Shanghai Jiao Tong University\n",
       "1                  Peking University\n",
       "2      Shanghai Jiao Tong University\n",
       "3                   Fudan University\n",
       "4                   Fudan University\n",
       "                   ...              \n",
       "195                 Fudan University\n",
       "196              Tsinghua University\n",
       "197    Shanghai Jiao Tong University\n",
       "198    Shanghai Jiao Tong University\n",
       "199              Tsinghua University\n",
       "Name: School, Length: 200, dtype: object>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['School'].unique"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "2b0a51dd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>158.9</td>\n",
       "      <td>46.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>166.5</td>\n",
       "      <td>70.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>188.9</td>\n",
       "      <td>89.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>41.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>174.0</td>\n",
       "      <td>74.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>195</th>\n",
       "      <td>153.9</td>\n",
       "      <td>46.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>196</th>\n",
       "      <td>160.9</td>\n",
       "      <td>50.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>197</th>\n",
       "      <td>153.9</td>\n",
       "      <td>45.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>175.3</td>\n",
       "      <td>71.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>199</th>\n",
       "      <td>155.7</td>\n",
       "      <td>51.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>200 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Height  Weight\n",
       "0     158.9    46.0\n",
       "1     166.5    70.0\n",
       "2     188.9    89.0\n",
       "3       NaN    41.0\n",
       "4     174.0    74.0\n",
       "..      ...     ...\n",
       "195   153.9    46.0\n",
       "196   160.9    50.0\n",
       "197   153.9    45.0\n",
       "198   175.3    71.0\n",
       "199   155.7    51.0\n",
       "\n",
       "[200 rows x 2 columns]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_demo = df[['Height','Weight']]\n",
    "df_demo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "2b809051",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>排名</td>\n",
       "      <td>排名变化</td>\n",
       "      <td>企业名称</td>\n",
       "      <td>价值（亿元人民币）</td>\n",
       "      <td>价值变化（亿元人民币）</td>\n",
       "      <td>国家</td>\n",
       "      <td>城市</td>\n",
       "      <td>行业</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>102 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      0     1                    2          3            4   5      6     7\n",
       "0    排名  排名变化                 企业名称  价值（亿元人民币）  价值变化（亿元人民币）  国家     城市    行业\n",
       "1     1     0                   抖音      13400       -10050  中国     北京  社交媒体\n",
       "2     2     1               SpaceX       8400         1680  美国    洛杉矶    航天\n",
       "3     3    -1                 蚂蚁集团       8000        -2010  中国     杭州  金融科技\n",
       "4     4     0               Stripe       4100        -2210  美国    旧金山  金融科技\n",
       "..   ..   ...                  ...        ...          ...  ..    ...   ...\n",
       "97   95   -16        Impossible 食品        470            0  美国  雷德伍德城  食品饮料\n",
       "98   95   -16                   微医        470            0  中国     杭州  健康科技\n",
       "99   99    58                 蜂巢能源        460          190  中国     常州   新能源\n",
       "100  99    -6           Better.com        460           60  美国     纽约  金融科技\n",
       "101  99   -20  Automation Anywhere        460          -10  美国    圣何塞  人工智能\n",
       "\n",
       "[102 rows x 8 columns]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hurun_独角兽 = pd.read_html('https://www.hurun.net/zh-CN/Info/Detail?num=L9SQPH9FKJB1')[-3]\n",
    "hurun_独角兽"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "aabd40f7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['排名', '排名变化', '企业名称', '价值（亿元人民币）', '价值变化（亿元人民币）', '国家', '城市', '行业']"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hurun_独角兽[0:1].values.tolist()[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "432411ab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>Shein</td>\n",
       "      <td>4000</td>\n",
       "      <td>2680</td>\n",
       "      <td>中国</td>\n",
       "      <td>广州</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>101 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      0    1                    2      3       4   5      6     7\n",
       "1     1    0                   抖音  13400  -10050  中国     北京  社交媒体\n",
       "2     2    1               SpaceX   8400    1680  美国    洛杉矶    航天\n",
       "3     3   -1                 蚂蚁集团   8000   -2010  中国     杭州  金融科技\n",
       "4     4    0               Stripe   4100   -2210  美国    旧金山  金融科技\n",
       "5     5   11                Shein   4000    2680  中国     广州  电子商务\n",
       "..   ..  ...                  ...    ...     ...  ..    ...   ...\n",
       "97   95  -16        Impossible 食品    470       0  美国  雷德伍德城  食品饮料\n",
       "98   95  -16                   微医    470       0  中国     杭州  健康科技\n",
       "99   99   58                 蜂巢能源    460     190  中国     常州   新能源\n",
       "100  99   -6           Better.com    460      60  美国     纽约  金融科技\n",
       "101  99  -20  Automation Anywhere    460     -10  美国    圣何塞  人工智能\n",
       "\n",
       "[101 rows x 8 columns]"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun = hurun_独角兽[1:]\n",
    "df_hurun"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "01432751",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>排名变化</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>价值（亿元人民币）</th>\n",
       "      <th>价值变化（亿元人民币）</th>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>抖音</td>\n",
       "      <td>13400</td>\n",
       "      <td>-10050</td>\n",
       "      <td>中国</td>\n",
       "      <td>北京</td>\n",
       "      <td>社交媒体</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>SpaceX</td>\n",
       "      <td>8400</td>\n",
       "      <td>1680</td>\n",
       "      <td>美国</td>\n",
       "      <td>洛杉矶</td>\n",
       "      <td>航天</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>-1</td>\n",
       "      <td>蚂蚁集团</td>\n",
       "      <td>8000</td>\n",
       "      <td>-2010</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>Stripe</td>\n",
       "      <td>4100</td>\n",
       "      <td>-2210</td>\n",
       "      <td>美国</td>\n",
       "      <td>旧金山</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>Shein</td>\n",
       "      <td>4000</td>\n",
       "      <td>2680</td>\n",
       "      <td>中国</td>\n",
       "      <td>广州</td>\n",
       "      <td>电子商务</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>Impossible 食品</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>美国</td>\n",
       "      <td>雷德伍德城</td>\n",
       "      <td>食品饮料</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>95</td>\n",
       "      <td>-16</td>\n",
       "      <td>微医</td>\n",
       "      <td>470</td>\n",
       "      <td>0</td>\n",
       "      <td>中国</td>\n",
       "      <td>杭州</td>\n",
       "      <td>健康科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>58</td>\n",
       "      <td>蜂巢能源</td>\n",
       "      <td>460</td>\n",
       "      <td>190</td>\n",
       "      <td>中国</td>\n",
       "      <td>常州</td>\n",
       "      <td>新能源</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>99</td>\n",
       "      <td>-6</td>\n",
       "      <td>Better.com</td>\n",
       "      <td>460</td>\n",
       "      <td>60</td>\n",
       "      <td>美国</td>\n",
       "      <td>纽约</td>\n",
       "      <td>金融科技</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>99</td>\n",
       "      <td>-20</td>\n",
       "      <td>Automation Anywhere</td>\n",
       "      <td>460</td>\n",
       "      <td>-10</td>\n",
       "      <td>美国</td>\n",
       "      <td>圣何塞</td>\n",
       "      <td>人工智能</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>101 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     排名 排名变化                 企业名称 价值（亿元人民币） 价值变化（亿元人民币）  国家     城市    行业\n",
       "1     1    0                   抖音     13400      -10050  中国     北京  社交媒体\n",
       "2     2    1               SpaceX      8400        1680  美国    洛杉矶    航天\n",
       "3     3   -1                 蚂蚁集团      8000       -2010  中国     杭州  金融科技\n",
       "4     4    0               Stripe      4100       -2210  美国    旧金山  金融科技\n",
       "5     5   11                Shein      4000        2680  中国     广州  电子商务\n",
       "..   ..  ...                  ...       ...         ...  ..    ...   ...\n",
       "97   95  -16        Impossible 食品       470           0  美国  雷德伍德城  食品饮料\n",
       "98   95  -16                   微医       470           0  中国     杭州  健康科技\n",
       "99   99   58                 蜂巢能源       460         190  中国     常州   新能源\n",
       "100  99   -6           Better.com       460          60  美国     纽约  金融科技\n",
       "101  99  -20  Automation Anywhere       460         -10  美国    圣何塞  人工智能\n",
       "\n",
       "[101 rows x 8 columns]"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.columns = hurun_独角兽[0:1].values.tolist()[0]\n",
    "df_hurun"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "f65e893d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['中国', '美国', '马耳他', '英国', '澳大利亚', '印度', '瑞典', '印度尼西亚', '巴哈马', '土耳其',\n",
       "       '墨西哥', '瑞士', '韩国', '德国', '越南', '以色列'], dtype=object)"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['国家'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "a29d728e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['社交媒体', '航天', '金融科技', '电子商务', '区块链', '大数据', '数字科技', '物流', '软件服务',\n",
       "       '教育科技', '新能源汽车', '快递', '机器人', '企业服务', '健康科技', '共享经济', '食品饮料',\n",
       "       '人工智能', '生物科技', '新能源', '保险', '新零售', '游戏', '网络安全', '分析', '消费品'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['行业'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "e5d11c41",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "163.21803278688526"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Height'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "4e9e8cc1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      46.0\n",
       "1      70.0\n",
       "2      89.0\n",
       "3      41.0\n",
       "4      74.0\n",
       "       ... \n",
       "195    46.0\n",
       "196    50.0\n",
       "197    45.0\n",
       "198    71.0\n",
       "199    51.0\n",
       "Name: Weight, Length: 200, dtype: float64"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Weight']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "043e2397",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "55.01587301587302"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Weight'].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "be19117b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1      中国\n",
       "2      美国\n",
       "3      中国\n",
       "4      美国\n",
       "5      中国\n",
       "       ..\n",
       "97     美国\n",
       "98     中国\n",
       "99     中国\n",
       "100    美国\n",
       "101    美国\n",
       "Name: 国家, Length: 101, dtype: object"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['国家']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "36203531",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "美国       49\n",
       "中国       26\n",
       "英国        7\n",
       "印度        4\n",
       "韩国        2\n",
       "瑞典        2\n",
       "印度尼西亚     2\n",
       "越南        1\n",
       "澳大利亚      1\n",
       "马耳他       1\n",
       "巴哈马       1\n",
       "土耳其       1\n",
       "墨西哥       1\n",
       "德国        1\n",
       "瑞士        1\n",
       "以色列       1\n",
       "Name: 国家, dtype: int64"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['国家'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "b80de7d4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "166.8    4\n",
       "156.0    3\n",
       "156.5    3\n",
       "160.6    3\n",
       "164.1    3\n",
       "        ..\n",
       "177.1    1\n",
       "164.8    1\n",
       "147.8    1\n",
       "175.0    1\n",
       "166.7    1\n",
       "Name: Height, Length: 141, dtype: int64"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Height'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "51a13856",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "金融科技     17\n",
       "软件服务     14\n",
       "区块链       9\n",
       "电子商务      8\n",
       "人工智能      6\n",
       "物流        5\n",
       "共享经济      4\n",
       "健康科技      4\n",
       "新能源       4\n",
       "快递        4\n",
       "网络安全      3\n",
       "社交媒体      2\n",
       "大数据       2\n",
       "新能源汽车     2\n",
       "游戏        2\n",
       "生物科技      2\n",
       "机器人       2\n",
       "企业服务      2\n",
       "食品饮料      2\n",
       "数字科技      1\n",
       "分析        1\n",
       "教育科技      1\n",
       "航天        1\n",
       "新零售       1\n",
       "保险        1\n",
       "消费品       1\n",
       "Name: 行业, dtype: int64"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun['行业'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "ade69a8e",
   "metadata": {},
   "outputs": [
    {
     "ename": "UndefinedVariableError",
     "evalue": "name '行业' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\scope.py\u001b[0m in \u001b[0;36mresolve\u001b[1;34m(self, key, is_local)\u001b[0m\n\u001b[0;32m    200\u001b[0m             \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhas_resolvers\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 201\u001b[1;33m                 \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mresolvers\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    202\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\collections\\__init__.py\u001b[0m in \u001b[0;36m__getitem__\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m    897\u001b[0m                 \u001b[1;32mpass\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 898\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__missing__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m            \u001b[1;31m# support subclasses that define __missing__\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    899\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\collections\\__init__.py\u001b[0m in \u001b[0;36m__missing__\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m    889\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0m__missing__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 890\u001b[1;33m         \u001b[1;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    891\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mKeyError\u001b[0m: '行业'",
      "\nDuring handling of the above exception, another exception occurred:\n",
      "\u001b[1;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\scope.py\u001b[0m in \u001b[0;36mresolve\u001b[1;34m(self, key, is_local)\u001b[0m\n\u001b[0;32m    211\u001b[0m                 \u001b[1;31m# e.g., df[df > 0]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 212\u001b[1;33m                 \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtemps\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    213\u001b[0m             \u001b[1;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0merr\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mKeyError\u001b[0m: '行业'",
      "\nThe above exception was the direct cause of the following exception:\n",
      "\u001b[1;31mUndefinedVariableError\u001b[0m                    Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-73-934574c7a06d>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mquery\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'行业'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\frame.py\u001b[0m in \u001b[0;36mquery\u001b[1;34m(self, expr, inplace, **kwargs)\u001b[0m\n\u001b[0;32m   3467\u001b[0m         \u001b[0mkwargs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"level\"\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpop\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"level\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   3468\u001b[0m         \u001b[0mkwargs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"target\"\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 3469\u001b[1;33m         \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0meval\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mexpr\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   3470\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   3471\u001b[0m         \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\frame.py\u001b[0m in \u001b[0;36meval\u001b[1;34m(self, expr, inplace, **kwargs)\u001b[0m\n\u001b[0;32m   3597\u001b[0m         \u001b[0mkwargs\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"resolvers\"\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"resolvers\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0mtuple\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresolvers\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   3598\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 3599\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0m_eval\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mexpr\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0minplace\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0minplace\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   3600\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m   3601\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mselect_dtypes\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0minclude\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mexclude\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m->\u001b[0m \u001b[0mDataFrame\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\eval.py\u001b[0m in \u001b[0;36meval\u001b[1;34m(expr, parser, engine, truediv, local_dict, global_dict, resolvers, level, target, inplace)\u001b[0m\n\u001b[0;32m    340\u001b[0m         )\n\u001b[0;32m    341\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 342\u001b[1;33m         \u001b[0mparsed_expr\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mExpr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mexpr\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mengine\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mengine\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mparser\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mparser\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0menv\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0menv\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    343\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    344\u001b[0m         \u001b[1;31m# construct the engine and evaluate the parsed expression\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expr.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, expr, engine, parser, env, level)\u001b[0m\n\u001b[0;32m    796\u001b[0m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mparser\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mparser\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    797\u001b[0m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_visitor\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mPARSERS\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mparser\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0menv\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mengine\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mparser\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 798\u001b[1;33m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mterms\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mparse\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    799\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    800\u001b[0m     \u001b[1;33m@\u001b[0m\u001b[0mproperty\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expr.py\u001b[0m in \u001b[0;36mparse\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m    815\u001b[0m         \u001b[0mParse\u001b[0m \u001b[0man\u001b[0m \u001b[0mexpression\u001b[0m\u001b[1;33m.\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    816\u001b[0m         \"\"\"\n\u001b[1;32m--> 817\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_visitor\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvisit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexpr\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    818\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    819\u001b[0m     \u001b[1;33m@\u001b[0m\u001b[0mproperty\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expr.py\u001b[0m in \u001b[0;36mvisit\u001b[1;34m(self, node, **kwargs)\u001b[0m\n\u001b[0;32m    399\u001b[0m         \u001b[0mmethod\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m\"visit_\"\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0mtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__name__\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    400\u001b[0m         \u001b[0mvisitor\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 401\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mvisitor\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    402\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    403\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mvisit_Module\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expr.py\u001b[0m in \u001b[0;36mvisit_Module\u001b[1;34m(self, node, **kwargs)\u001b[0m\n\u001b[0;32m    405\u001b[0m             \u001b[1;32mraise\u001b[0m \u001b[0mSyntaxError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"only a single expression is allowed\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    406\u001b[0m         \u001b[0mexpr\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mnode\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mbody\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 407\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvisit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mexpr\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    408\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    409\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mvisit_Expr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expr.py\u001b[0m in \u001b[0;36mvisit\u001b[1;34m(self, node, **kwargs)\u001b[0m\n\u001b[0;32m    399\u001b[0m         \u001b[0mmethod\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m\"visit_\"\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0mtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__name__\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    400\u001b[0m         \u001b[0mvisitor\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 401\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mvisitor\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    402\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    403\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mvisit_Module\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expr.py\u001b[0m in \u001b[0;36mvisit_Expr\u001b[1;34m(self, node, **kwargs)\u001b[0m\n\u001b[0;32m    408\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    409\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mvisit_Expr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 410\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvisit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    411\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    412\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0m_rewrite_membership_op\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mleft\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mright\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expr.py\u001b[0m in \u001b[0;36mvisit\u001b[1;34m(self, node, **kwargs)\u001b[0m\n\u001b[0;32m    399\u001b[0m         \u001b[0mmethod\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m\"visit_\"\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0mtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__name__\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    400\u001b[0m         \u001b[0mvisitor\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 401\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mvisitor\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    402\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    403\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mvisit_Module\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expr.py\u001b[0m in \u001b[0;36mvisit_Name\u001b[1;34m(self, node, **kwargs)\u001b[0m\n\u001b[0;32m    533\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    534\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mvisit_Name\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 535\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mterm_type\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mid\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0menv\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    536\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    537\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mvisit_NameConstant\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnode\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\ops.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, name, env, side, encoding)\u001b[0m\n\u001b[0;32m     84\u001b[0m         \u001b[0mtname\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mstr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     85\u001b[0m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mis_local\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtname\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstartswith\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mLOCAL_TAG\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0mtname\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mDEFAULT_GLOBALS\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 86\u001b[1;33m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_value\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_resolve_name\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     87\u001b[0m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mencoding\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mencoding\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     88\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\ops.py\u001b[0m in \u001b[0;36m_resolve_name\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m    101\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    102\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0m_resolve_name\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 103\u001b[1;33m         \u001b[0mres\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0menv\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mresolve\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlocal_name\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mis_local\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mis_local\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    104\u001b[0m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mres\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    105\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\anaconda3\\lib\\site-packages\\pandas\\core\\computation\\scope.py\u001b[0m in \u001b[0;36mresolve\u001b[1;34m(self, key, is_local)\u001b[0m\n\u001b[0;32m    215\u001b[0m                 \u001b[1;32mfrom\u001b[0m \u001b[0mpandas\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcore\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcomputation\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mops\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mUndefinedVariableError\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    216\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 217\u001b[1;33m                 \u001b[1;32mraise\u001b[0m \u001b[0mUndefinedVariableError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mis_local\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0merr\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    218\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    219\u001b[0m     \u001b[1;32mdef\u001b[0m \u001b[0mswapkey\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mold_key\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnew_key\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnew_value\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mUndefinedVariableError\u001b[0m: name '行业' is not defined"
     ]
    }
   ],
   "source": [
    "df.query()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "3e37af9a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>School</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Fudan University</th>\n",
       "      <td>162.408824</td>\n",
       "      <td>54.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Peking University</th>\n",
       "      <td>162.977419</td>\n",
       "      <td>55.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Shanghai Jiao Tong University</th>\n",
       "      <td>163.932727</td>\n",
       "      <td>56.442308</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Tsinghua University</th>\n",
       "      <td>163.149206</td>\n",
       "      <td>54.223881</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                   Height     Weight\n",
       "School                                              \n",
       "Fudan University               162.408824  54.000000\n",
       "Peking University              162.977419  55.666667\n",
       "Shanghai Jiao Tong University  163.932727  56.442308\n",
       "Tsinghua University            163.149206  54.223881"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby('School').agg({'Height':'mean','Weight':'mean'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "5a35d292",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Height</th>\n",
       "      <th>Weight</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>School</th>\n",
       "      <th>Gender</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Fudan University</th>\n",
       "      <th>Female</th>\n",
       "      <td>158.776923</td>\n",
       "      <td>47.900000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>174.212500</td>\n",
       "      <td>72.300000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Peking University</th>\n",
       "      <th>Female</th>\n",
       "      <td>158.666667</td>\n",
       "      <td>46.650000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>172.030000</td>\n",
       "      <td>73.700000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Shanghai Jiao Tong University</th>\n",
       "      <th>Female</th>\n",
       "      <td>159.122500</td>\n",
       "      <td>48.513514</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>176.760000</td>\n",
       "      <td>76.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">Tsinghua University</th>\n",
       "      <th>Female</th>\n",
       "      <td>159.753333</td>\n",
       "      <td>48.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Male</th>\n",
       "      <td>171.638889</td>\n",
       "      <td>69.947368</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                          Height     Weight\n",
       "School                        Gender                       \n",
       "Fudan University              Female  158.776923  47.900000\n",
       "                              Male    174.212500  72.300000\n",
       "Peking University             Female  158.666667  46.650000\n",
       "                              Male    172.030000  73.700000\n",
       "Shanghai Jiao Tong University Female  159.122500  48.513514\n",
       "                              Male    176.760000  76.000000\n",
       "Tsinghua University           Female  159.753333  48.000000\n",
       "                              Male    171.638889  69.947368"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(['School','Gender']).agg({'Height':'mean','Weight':'mean'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "8e7475a8",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-82-1e80b7b96b60>:1: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame.\n",
      "Try using .loc[row_indexer,col_indexer] = value instead\n",
      "\n",
      "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  df_hurun['价值（亿元人民币）'] = df_hurun['价值（亿元人民币）'].astype('int64')\n"
     ]
    }
   ],
   "source": [
    "df_hurun['价值（亿元人民币）'] = df_hurun['价值（亿元人民币）'].astype('int64')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "450a2236",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>价值（亿元人民币）</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>46055</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>535</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>3235</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>土耳其</th>\n",
       "      <td>800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>墨西哥</th>\n",
       "      <td>580</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴哈马</th>\n",
       "      <td>1300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>德国</th>\n",
       "      <td>555</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>澳大利亚</th>\n",
       "      <td>1750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <td>2100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <td>575</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <td>47740</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <td>6575</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>越南</th>\n",
       "      <td>550</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <td>1095</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <td>3000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       价值（亿元人民币）\n",
       "国家              \n",
       "中国         46055\n",
       "以色列          535\n",
       "印度          3235\n",
       "印度尼西亚       2000\n",
       "土耳其          800\n",
       "墨西哥          580\n",
       "巴哈马         1300\n",
       "德国           555\n",
       "澳大利亚        1750\n",
       "瑞典          2100\n",
       "瑞士           575\n",
       "美国         47740\n",
       "英国          6575\n",
       "越南           550\n",
       "韩国          1095\n",
       "马耳他         3000"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_hurun.groupby('国家').agg({'价值（亿元人民币）':'sum'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a8132030",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
